<?php
/*
 * @version :  2013-4-22
 * @project :  account-system
 * @Author  :  Allen
 * @e-mail  :  shulei@maszy.cn
 */

if($_REQUEST['method']=="pic_ads"){
	$content = getPicAdsXml();
}else if($_REQUEST['method']=="text_ads"){
	$content = getTextAdsXml();
}
outPutXml($content);
function getTextAdsXml(){
	$content = "";
	if(isset($_REQUEST['mac'])){
		$content.= "<freetime>60</freetime>\n";
		$content.= "<result>\n";
		$content.= "<id>1</id>\n";
		$content.= "<position>header</position>\n";
		$content.= "<content>Welcome to NetCube 1.</content>\n";
		$content.= "</result>\n";
		$content.= "<result>\n";
		$content.= "<id>2</id>\n";
		$content.= "<position>bottom</position>\n";
		$content.= "<content>Welcome to NetCube 2.</content>\n";
		$content.= "</result>\n";
	}
	return $content;
}
function getPicAdsXml(){
	$content = "";
	if(isset($_REQUEST['mac'])){
		$content.= "<result>\n";
		$content.= "<id>1</id>\n";
		$content.= "<type>type1</type>\n";
		$content.= "<position>center</position>\n";
		$content.= "<imgurl>http://cp.netcube.com.au/ads/pic/1.gif</imgurl>\n";
		$content.= "</result>\n";
		$content.= "<result>\n";
		$content.= "<id>2</id>\n";
		$content.= "<type>type2</type>\n";
		$content.= "<position>center</position>\n";
		$content.= "<imgurl>http://cp.netcube.com.au/ads/pic/2.gif</imgurl>\n";
		$content.= "</result>\n";
	}
	return $content;
}
function outPutXml($content) {
	header("Content-type:text/xml");
	echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n";
	echo "<netcuberesult>\n";
	echo $content;
	echo "</netcuberesult>";
	die();
}
